1. Field of the Invention
The present invention relates to rate control for moving picture encoding.
2. Description of the Related Art
According to an encoding method which quantizes a DCT coefficient standardized with JPEG or H.264, for example, the quantization width of a DCT coefficient is changed frame by frame in encoding to reduce the bit rate of an image. The technology called rate control controls the bit rate of an image by changing the quantization width to fit into a designated rate.
Since the quantization width is a nonlinear value space with respect to the image quality or size, it is difficult to use the quantization width itself to control the rate. Thus, in real rate control, the calculation for rate control is performed with an easier-to-control numerical space called a quantization parameter, the quantization parameter is converted to a quantization width in order to quantize a DCT coefficient for encoding. As the value of the quantization parameter decreases, the image quality of the image to be acquired increases. However, the rate also increases. As the value increases, the image quality decreases. However, the rate also decreases. On the other hand, for example, Japanese Patent Laid-Open No. 2006-109420 discloses a method for controlling a quantization parameter such that the product of the rate and the quantization parameter can be a constant value.
In rate control for video encoding, the balance between the image quality and the rate is adjusted for each frame, block or both for determining the quantization parameter, and the rates of a plurality of frames are serially controlled to fit into a predetermined rate. For example, if it is estimated that the rate (real bit rate) will be larger than a designated rate when a frame or a block is started to encode, the quantization parameter is reduced for the encoding. Conversely, if it is estimated that the real bit rate will be smaller than the designated rate, the quantization parameter must be increased for the encoding. The real bit rate here is handled as a bit rate of streams generated by encoding images up to the previous frame or previous block. When the final frame is finished to encode, the bit rate of streams itself is the real bit rate.
Various quantization parameter calculation methods have been proposed in the past. For example, Japanese Patent Laid-Open No. 2006-74347 describes calculation of a quantization parameter on the basis of occupancy of a buffer and the complexity of an image.
Quantization noise is perceived when image quality deteriorates because the quantization parameter is increased for encoding. In this case, when the quantization parameter rapidly varies in time, the quantization noise increases or decreases. This flickers the quantization noise.